<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<script type="text/javascript">
    $(function() {

        var entityManagement = new EntityManagement();
        entityManagement.entityName = "用户";
        entityManagement.entityPath = "/auth/user";
        entityManagement.entityTable = "management";
        $("#" + entityManagement.entityTable).flexigrid({
            url : 'list.action',
            dataType : 'json',
            colModel : [
                {display: 'ID', name : 'id', width : 20, sortable : true, align: 'center',hide: false},
                {display: '登录名', name : 'loginName', width : 200, sortable : true, align: 'center'},
                {display: '姓名', name : 'name', width : 100, sortable : true, align: 'center'},
                {display: '状态', name : 'enabled', width : 50, sortable : true, align: 'center'},
                {display: '邮件', name : 'email', width : 100, sortable : true, align: 'center'},
                {display: '角色', name : 'roleNames', width : 200, sortable : true, align: 'left'},
                {display: '权限', name : 'authNames', width : 200, sortable : true, align: 'left'}
            ],
            buttons : [
                {name : '新增', bclass : 'add', onpress : entityManagement.add},
                {separator : true},// 设置分割线
                {name : '修改', bclass : 'edit', onpress : entityManagement.edit},
                {separator : true},
                /*{name : '删除', bclass : 'delete', onpress : entityManagement.confirmDel},
                {separator : true},*/
                {name : '初始化密码', bclass : 'init', onpress : init},
                {separator : true}
            ]
        });

        //初始化用户
        function init(com, grid) {
            if(BossUtils.checkSingleRecord(com, grid)) {
                row_id = BossUtils.getCurrentRecord(com, grid);
                top.qBox.iFLoad({title:'初始化密码',src:ctx + "/auth/user/init.action?id=" + row_id, afterHide:entityManagement.refresh});
            }
        }
    });
</script>